package day03;

public class MaximumCommonDivisorAndLeastCommonMultiple {
	public static void main(String[] args) {
		 int a = Integer.parseInt(args[0]);
		 int b = Integer.parseInt(args[1]);
		 int x,y;
		 x=maximumCommonDivisor(a,b);
		 System.out.println(a+"和"+b+"最大公约数="+x);
		 y=leastCommonMultiple(a,b);
		 System.out.println(a+"和"+b+"最大公倍数="+y);
	}
	 private static int maximumCommonDivisor(int a,int b) {
		 int r;
		 int x=0;
		 int temp;
		 if(a<b)
		 {
			 temp=a;
			 a=b;
			 b=temp;
		 }
			 do
			 {
				 r=a%b;
				 a=b;
				 b=r;
			 }while(r!=0);
			 x=a;	 
		 
		 return x;
	}
	 private static int leastCommonMultiple(int a,int b) {
		 int y;
		 y=(a*b)/maximumCommonDivisor(a,b);
		 return y;
		
	}
}
